<template>
  <div class="child">
    <p>父组件中的数据：{{code}} _{{username}}</p>
    <p>父组件中param：{{param}}</p>
    <div>
      <button @click="childMethod()">点击</button>
    </div>
  </div>
</template>
<script>
export default {
  name: 'childPage',
  props: {
    code: String,
    username: String,
    param: String,
    childOneText: String,
    testThree: {
      type: Function,
      default: null
    }
  },
  data () {
    return {

    }
  },
  watch: {
    param: {
      handler (newVal, oldVal) {
        console.log(newVal + '_____' + oldVal)
      }
    }
  },
  methods: {
    testOne () {
      this.$emit('update:childOneText', '1243')
    },
    testTwo () {
    },
    childMethod () {
      debugger
      if (this.testThree) {
        this.testThree()
      }
    }
  },
  created () {
    this.testOne()
    this.testTwo()
  }

}
</script>
